package cn.comon.app.scan.component;

import java.util.Properties;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;

import cn.comon.app.scan.util.UtilTools;

/**
 * 配置文件获取
 * @author xujf
 *
 */
@Component
public class SysConfigBean {
    private static Logger logger = Logger.getLogger(SysConfigBean.class.getName());
    private static Properties props = null;
    /*读取属性文件 */
    private static final String FILE_NAME = "Analysis.properties";
    public SysConfigBean () {
    }

    private static void init() {
    	try {
			props = UtilTools.getPropertiesFile(FILE_NAME);
		} catch (Exception e) {
			logger.error("加载配置文件异常：",e);
		}
    }
    public static Properties getSysConfigFile () {
    	if (props == null) {
    		init();
    	}
        return props;
    }
    /**
     * 获取系统参数
     * @param key
     * @return
     */
    public static String getProperty(String key){
    	return getSysConfigFile().getProperty(key);
    }
}
